<?php

/**
 * 夏日葵电商系统
 * http://www.xiarikui.com
 */

namespace Xcx\Model;

use Think\Model\RelationModel;

/**
 * Class QuestionModel
 * @package Home\Model
 */
class CategoryModel extends RelationModel {

    public  $tableName = 'categories';

    public function getInfoById($id) {
        $id = $id ? $id : 0;
        return M('categories')->where('is_show = 1 and id = '.$id)->find();
    }

    public function getList() {
        return M('categories')->where('is_show = 1')->order('sort_order asc')->select();
    }

    public function getKVList() {
        return M('categories')->where('is_show = 1')->order('sort_order asc')->getField('id,cat_name');
    }
}
